#
# Makefile for to make stuffs
# Chiip (ATmega8L8) version
# OpenWii - YOLD 3173
#

# cross compiler
# CHANGE THIS TO YOUR COMPILER'S BINARY DIRECTORY AND CROSS COMPILER PREFIX
CROSS_COMPILE_PATH =
CROSS_COMPILE_PREFIX = avr-

#ADD builddir!!!

#what chip are we using
MCU = atmega8

# what files to use for each section.
CFILES = archdep.o eeprom.o
HEADERS = archdep.h
BINARYS = $(BUILDDIR)mn10200-dms.bin $(BUILDDIR)mn10200-d2b.bin
ASMFILES =

#linker script and symbols filenames
LDSCRIPT = avr4_atmega8.lds

# compiler flags for C compiler and assembler..
CFLAGS = -Os -fpic -c -mmcu=$(MCU) -Wall
AFLAGS = -mmcu=$(MCU)
LDFLAGS = -LC:/Programme/WinAVR/avr/lib/avr4/ -lc C:/Programme/WinAVR/avr/lib/avr4/crtm8.o

include ../common/common.mk

#link it all together! this determines what we are actually aiming to create
link: $(BINNAME).hex $(BINNAME).bin $(BINNAME).elf

ifdef withbootloader
	../../../AVRDude/avrdude.exe -p m8 -c sp12 -U flash:w:openwii-loader.hex -U eeprom:w:0x02,0x60:m -U lfuse:w:0xE3:m -U hfuse:w:0xDB:m -v
endif
